package cn.woniu.ecommerceplatform.controller;

import cn.woniu.ecommerceplatform.entity.Label;
import cn.woniu.ecommerceplatform.service.LabelService;
import cn.woniu.ecommerceplatform.util.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("label")
public class LabelController {
    @Autowired
    private LabelService labelService;
    @RequestMapping("query")
    public ResponseResult<?> queryList(String labelName,Integer pageNum,Integer pageSize){
        return labelService.queryList(labelName,pageNum,pageSize);
    }
    @PostMapping("insert")
    public ResponseResult<?> insertLabel(@RequestBody Label label){
        return labelService.insertLabel(label);
    }
    @RequestMapping("delete")
    public ResponseResult<?> deleteById(Integer id){
        return labelService.deleteById(id);
    }
    @PostMapping("deleteList")
    public ResponseResult<?> deleteList(@RequestBody Integer[] ids){
        return labelService.deleteList(ids);
    }
    @PostMapping("update")
    public ResponseResult<?> updateLabel(@RequestBody Label label){
        return labelService.updateLabelById(label);
    }
}
